// 根据断面控制级别code获取class
export function controlLevelCode (code) {
  const levelMap = {
    0: "controlLevel1",
    1: "controlLevel2",
    2: "controlLevel3",
  };
  return levelMap[code] || "";
}

// 根据水质级别控制级别code获取class
export function qualityLevelCode (code) {
  const levelMap = {
    0: "qualityLevel",
    1: "qualityLevel1",
    2: "qualityLevel2",
    3: "qualityLevel3",
    4: "qualityLevel4",
    5: "qualityLevel5",
    6: "qualityLevel6",
    无类别: "qualityLevel",
    未测: "qualityLevel",
    无数据: "qualityLevel",
    Ⅰ类: "qualityLevel1",
    Ⅱ类: "qualityLevel2",
    Ⅲ类: "qualityLevel3",
    Ⅳ类: "qualityLevel4",
    Ⅴ类: "qualityLevel5",
    劣Ⅴ类: "qualityLevel6",
  };
  return levelMap[code] || "";
}

export function getNamebylevel (level) {
  level ?? 0;
  if (level == 0) {
    return "无类别";
  } else if (level == 1) {
    return "Ⅰ类 ";
  } else if (level == 2) {
    return "Ⅱ类";
  } else if (level == 3) {
    return "Ⅲ类";
  } else if (level == 4) {
    return "Ⅳ类";
  } else if (level == 5) {
    return "Ⅴ类";
  } else if (level == 6) {
    return "劣Ⅴ类";
  } else {
    return level;
  }
}
export function getColorbylevel (level) {
  const level1 = "#CCFFFF";
  const level2 = "#00CCFF";
  const level3 = "#00FF00";
  const level4 = "#FFFF00";
  const level5 = "#FF9B00";
  const level6 = "#FF0000";
  const nonelevel = "#757f8d";
  const nulllevel = "transparent";
  const levelMap = {
    0: nonelevel,
    1: level1,
    2: level2,
    3: level3,
    4: level4,
    5: level5,
    6: level6,
    null: nulllevel,
    无类别: nonelevel,
    未测: nonelevel,
    无数据: nonelevel,
    Ⅰ类: level1,
    Ⅱ类: level2,
    Ⅲ类: level3,
    Ⅳ类: level4,
    Ⅴ类: level5,
    劣Ⅴ类: level6,
  };
  return levelMap[level] || "";
}
export function echartColors () {
  return [
    "#219cf9",
    "#ffd351",
    "#c065e7",
    "#6ebffb",
    "#765deb",
    "#f56b6d",
    "#3862d8",
    "#40c057",
    "#ffd351",
    "#EA0DED",
    "#7B05FF",
    "#597990",
    "#EBCD00",
    "#606400",
    "#C8426B",
    "#8EB6FF",
    "#BABB48",
    "#FF8BCA",
    "#0F7584",
    "#FFB266",
    "#3AA27A",
    "#00D2FF",
    "#973481",
    "#008FF3",
    "#C3818E",
    "#FF3C00",
    "#6E941E",
    "#F67171",
    "#35A0C7",
    "#C38465",
    "#BBA8B2",
    "#A18F15",
    "#00988F",
    "#80552B",
    "#93C9A5",
    "#1F02D4",
    "#AA11CC",
    "#DDDDDD",
  ];
}

export function getNourishmentColor (code) {
  const levelColor = {
    贫营养: "#2ac2ec",
    中营养: "#6dbd44",
    轻度富营养: "#eae84c",
    中度富营养: "#f69330",
    重度富营养: "#ef4643",
    null: "",
  };
  return levelColor[code] || "";
}
export function assessmentLevel (code) {
  const levelColor = {
    优: 1,
    良好: 2,
    轻度污染: 3,
    中度污染: 4,
    重度污染: 5,
    undefined: 6,
    null: 6,
    "": 6,
  };
  return levelColor[code] || "";
}
//level:整治情况
//time:完成期限
export function getWarningColor (level, time) {
  if (level == "3") {
    return "#40c057";
  } else {
    if (new Date() > new Date(time)) {
      return "#f56b6d";
    } else if (new Date() < new Date(time) - 3 * 24 * 60 * 60 * 1000) {
      return "#f2d916";
    } else {
      return "#FF8E43";
    }
  }
}
